#ifndef UDPSOCKET_H
#define UDPSOCKET_H

#include <QObject>
#include <QUdpSocket>
#include <QHostAddress>
#include <QString>

class UdpSocket : public QObject
{
    Q_OBJECT
public:
    explicit UdpSocket(QObject *parent = 0);
    Q_PROPERTY(QString mdata READ mdata NOTIFY mdataChanged)

    QString mdata();
    Q_INVOKABLE void listentPort(int port);
    Q_INVOKABLE void sendDatas(QString addressk,int port,QString data);

signals:
    void mdataChanged();


public slots:
    void readDatas();
private:
    QUdpSocket *socket;
    QString currentDatas;


};

#endif // UDPSOCKET_H
